<script setup>
import { ElCard } from 'element-plus'
const currentBaseURL =
  window.location.origin + window.location.pathname.split('/').slice(0, -1).join('/')
defineProps({
  hotsellings: Object
})

</script>

<template>
  <div class="maincontainer">
    <el-card v-for="hotselling in hotsellings" :key="hotselling.id" class="container">
      <a :href="currentBaseURL + '/' + hotselling.id">
        <img v-lazyImg="hotselling.picture" alt="" class="image" />
        <p class="name">{{ hotselling.name }}</p>
        <p class="describe">{{ hotselling.desc }}</p>
        <p class="price">¥{{ hotselling.price }}</p>
      </a>
    </el-card>
  </div>
</template>

<style lang="scss" scoped>
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
  width: 250px;
  margin-bottom: 20px;
}

a {
  text-decoration: none;
  padding: 10px 20px;
  margin: 5px;
}

.name {
  color: black;
  font-size: 10px;
  text-align: center;
}

.describe {
  color: #888;
  text-align: center;
  font-size: 8px;
}

.price {
  color: red;
  text-align: center;
  font-size: 15px;
}
</style>
